<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>BabyOS: b_suart.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="2.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">BabyOS
   &#160;<span id="projectnumber">V1.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_b9223522bb56aee4ab59f7ba381d2163.html">bos</a></li><li class="navelem"><a class="el" href="dir_bd0e78931a998067c69a2f2b1c188ef6.html">drivers</a></li><li class="navelem"><a class="el" href="dir_66d2336a6add43b86bead8301b0536f4.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">b_suart.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="b__suart_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">/*Includes ----------------------------------------------*/</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="b__suart_8h.html">b_suart.h</a>&quot;</span> </div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="b__hal_8h.html">b_hal.h</a>&quot;</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;<span class="preprocessor">#include &lt;string.h&gt;</span>  </div><div class="line"><a name="l00078"></a><span class="lineno"><a class="line" href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">   78</a></span>&#160;<a class="code" href="structb_driver_interface__t.html">SUART_Driver_t</a> <a class="code" href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">SUART_Driver</a> = </div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;{</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    .<a class="code" href="structb_driver_interface__t.html#a857eaefcde68aba9fe0d2170a660fdfb">init</a> = <a class="code" href="group___s_u_a_r_t___exported___functions.html#ga4905cf58b8ed4c083969f3f9131e38ff">SUART_Init</a>,</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;};</div><div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="keyword">static</span> <a class="code" href="struct_s___r_x_info__t.html">S_RXInfo_t</a> S_RXInfo = {</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    .<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> = <a class="code" href="group___s_u_a_r_t___exported___defines.html#ga7b0fd6f9d6d235df0a71ae2e1a1277b6">S_RX_S_NULL</a>,</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    .c_bits = 0,</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    .count = 0,</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    .revf = 0,</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    .idle_flag = 0,</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;}; </div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="keyword">static</span> <span class="keyword">volatile</span> uint8_t TxDelayFlag = 0; </div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> _S_UartStatusReset()</div><div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;{</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;    S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aef4c4f3630ede69cba8c75369a5459af">count</a> = 0;</div><div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a02fecce62db76d446cceec8d87e330f9">idle_flag</a> = 0;</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;}</div><div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;<span class="keyword">static</span> <span class="keywordtype">void</span> _S_UartTxDelay()</div><div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;{</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    TxDelayFlag = 0;</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="keywordflow">while</span>(TxDelayFlag == 0);</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;}</div><div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;</div><div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span> _S_UartSendByte(uint8_t byte)</div><div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;{</div><div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    uint8_t i = 0;</div><div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    _S_UartTxDelay();</div><div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;    <a class="code" href="group___h_a_l___exported___defines.html#gadd41bc5ddcf6f842928efc4f0d944a57">S_TX_PIN_RESET</a>();</div><div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    _S_UartTxDelay();</div><div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="keywordflow">for</span>(i = 0;i &lt; 8;i++)</div><div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    {</div><div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        <span class="keywordflow">if</span>(byte &amp; 0x01)</div><div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        {</div><div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;            <a class="code" href="group___h_a_l___exported___defines.html#gac5645a8f806359e621559359dadfc7c5">S_TX_PIN_SET</a>();</div><div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;        }</div><div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;        <span class="keywordflow">else</span></div><div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;        {</div><div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;            <a class="code" href="group___h_a_l___exported___defines.html#gadd41bc5ddcf6f842928efc4f0d944a57">S_TX_PIN_RESET</a>();</div><div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;        }</div><div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;        _S_UartTxDelay();</div><div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        byte &gt;&gt;= 1;</div><div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    }</div><div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <a class="code" href="group___h_a_l___exported___defines.html#gac5645a8f806359e621559359dadfc7c5">S_TX_PIN_SET</a>();</div><div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;}</div><div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;</div><div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span> _S_UartSendBuf(uint32_t off, uint8_t *pbuf,uint16_t len)</div><div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;{</div><div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    <span class="keywordflow">if</span>(pbuf == <a class="code" href="b__config_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)</div><div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    {</div><div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160;    }</div><div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;    uint16_t i = 0;</div><div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;    <span class="keywordflow">for</span>(i = 0;i &lt; len;i++)</div><div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;    {</div><div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        _S_UartSendByte(pbuf[i]);</div><div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;    }</div><div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;    <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;}</div><div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;</div><div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span> _S_UartRead(uint32_t off, uint8_t *pbuf, uint16_t len)</div><div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;{</div><div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordflow">if</span>(pbuf == <a class="code" href="b__config_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)</div><div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    {</div><div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    }</div><div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a02fecce62db76d446cceec8d87e330f9">idle_flag</a>)</div><div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;    {</div><div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;        <span class="keywordflow">if</span>(len &gt;= S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aef4c4f3630ede69cba8c75369a5459af">count</a>)</div><div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;        {</div><div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;            len = S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aef4c4f3630ede69cba8c75369a5459af">count</a>;</div><div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;        }</div><div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;        memcpy(pbuf, S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aa2665ebcc94066966583ee7c2c754862">buf</a>, len);</div><div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;        _S_UartStatusReset();</div><div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;        <span class="keywordflow">return</span> len;</div><div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    }</div><div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    <span class="keywordflow">return</span> -1;</div><div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;}</div><div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;</div><div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span> _SUartNullF()</div><div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;{</div><div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;}</div><div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;</div><div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;<span class="keyword">static</span> <span class="keywordtype">int</span> _SUartCtl(uint8_t cmd, <span class="keywordtype">void</span> * param)</div><div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160;{</div><div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;}</div><div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;</div><div class="line"><a name="l00201"></a><span class="lineno"><a class="line" href="group___s_u_a_r_t___exported___functions.html#gaf0674055c3083cfcf4e20633f1deabb2">  201</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_u_a_r_t___exported___functions.html#gaf0674055c3083cfcf4e20633f1deabb2">S_UartTxTimerHandler</a>()</div><div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;{</div><div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;    TxDelayFlag = 1;</div><div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;} </div><div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;</div><div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="group___s_u_a_r_t___exported___functions.html#ga2de0a2047cfba22db54132164576cc18">  209</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_u_a_r_t___exported___functions.html#ga2de0a2047cfba22db54132164576cc18">S_UartRXStart</a>()</div><div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;{</div><div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;    <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> == <a class="code" href="group___s_u_a_r_t___exported___defines.html#ga7b0fd6f9d6d235df0a71ae2e1a1277b6">S_RX_S_NULL</a>)</div><div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    {</div><div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> = <a class="code" href="group___s_u_a_r_t___exported___defines.html#gaa319b4bfa61f71bb997013eb2de3eee4">S_RX_S_START</a>;</div><div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a533890957460cf4f360cf222426df810">c_bits</a> = 0;</div><div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a62e96a9ecdde0ab8494d1dae9762f595">byte</a> = 0; </div><div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a2fca36c37bbd385665d8d422df068370">idle_count</a> = 0;</div><div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a02fecce62db76d446cceec8d87e330f9">idle_flag</a> = 0;</div><div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    }</div><div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;}</div><div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;</div><div class="line"><a name="l00224"></a><span class="lineno"><a class="line" href="group___s_u_a_r_t___exported___functions.html#gab302ede121d8fa7a6452427523b1ffeb">  224</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___s_u_a_r_t___exported___functions.html#gab302ede121d8fa7a6452427523b1ffeb">S_UartRxTimerHandler</a>()</div><div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;{</div><div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;    <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> == <a class="code" href="group___s_u_a_r_t___exported___defines.html#gaa319b4bfa61f71bb997013eb2de3eee4">S_RX_S_START</a>)</div><div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;    {</div><div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> = <a class="code" href="group___s_u_a_r_t___exported___defines.html#ga23061086cd3c27746726d9a21801339a">S_RX_S_ING</a>;</div><div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160;    }</div><div class="line"><a name="l00230"></a><span class="lineno">  230</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> == <a class="code" href="group___s_u_a_r_t___exported___defines.html#ga23061086cd3c27746726d9a21801339a">S_RX_S_ING</a>)</div><div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;    {</div><div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a62e96a9ecdde0ab8494d1dae9762f595">byte</a> &gt;&gt;= 1;</div><div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;        <span class="keywordflow">if</span>(<a class="code" href="group___h_a_l___exported___defines.html#gac1fbe03efbe22feb97f198a4dd8b1237">S_RX_PIN_READ</a>() == GPIO_PIN_SET)</div><div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160;        {</div><div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;            S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a62e96a9ecdde0ab8494d1dae9762f595">byte</a> |= 0x80;</div><div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;        }</div><div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;        S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a533890957460cf4f360cf222426df810">c_bits</a> += 1;</div><div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;        <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a533890957460cf4f360cf222426df810">c_bits</a> &gt;= 8)</div><div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        {</div><div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;            <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a02fecce62db76d446cceec8d87e330f9">idle_flag</a>)</div><div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;            {</div><div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;                _S_UartStatusReset();</div><div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;            }</div><div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160;            <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aef4c4f3630ede69cba8c75369a5459af">count</a> &lt; 128)</div><div class="line"><a name="l00245"></a><span class="lineno">  245</span>&#160;            {</div><div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;                S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aa2665ebcc94066966583ee7c2c754862">buf</a>[S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aef4c4f3630ede69cba8c75369a5459af">count</a>] = S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a62e96a9ecdde0ab8494d1dae9762f595">byte</a>;</div><div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;                S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#aef4c4f3630ede69cba8c75369a5459af">count</a> += 1;</div><div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;            }</div><div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;            S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a34ed48d0499d28be718165306a573aeb">revf</a> = 1;</div><div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160;            S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> = <a class="code" href="group___s_u_a_r_t___exported___defines.html#ga7b0fd6f9d6d235df0a71ae2e1a1277b6">S_RX_S_NULL</a>;</div><div class="line"><a name="l00251"></a><span class="lineno">  251</span>&#160;        }</div><div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;    }   </div><div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">status</a> == <a class="code" href="group___s_u_a_r_t___exported___defines.html#ga7b0fd6f9d6d235df0a71ae2e1a1277b6">S_RX_S_NULL</a>)</div><div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    {</div><div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;        <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a34ed48d0499d28be718165306a573aeb">revf</a> == 1 &amp;&amp; S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a02fecce62db76d446cceec8d87e330f9">idle_flag</a> == 0)</div><div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;        {</div><div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;            S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a2fca36c37bbd385665d8d422df068370">idle_count</a> += 1;</div><div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;            <span class="keywordflow">if</span>(S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a2fca36c37bbd385665d8d422df068370">idle_count</a> &gt; 3)</div><div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;            {</div><div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;                S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a34ed48d0499d28be718165306a573aeb">revf</a> = 0;</div><div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;                S_RXInfo.<a class="code" href="struct_s___r_x_info__t.html#a02fecce62db76d446cceec8d87e330f9">idle_flag</a> = 1;</div><div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;            }</div><div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160;        }</div><div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;    }</div><div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;}</div><div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;</div><div class="line"><a name="l00267"></a><span class="lineno"><a class="line" href="group___s_u_a_r_t___exported___functions.html#ga4905cf58b8ed4c083969f3f9131e38ff">  267</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="group___s_u_a_r_t___exported___functions.html#ga4905cf58b8ed4c083969f3f9131e38ff">SUART_Init</a>()</div><div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160;{</div><div class="line"><a name="l00269"></a><span class="lineno">  269</span>&#160;    <a class="code" href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">SUART_Driver</a>.<a class="code" href="structb_driver_interface__t.html#a533fda1241149e9fe787957492b2b1fc">close</a> = _SUartNullF;</div><div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;    <a class="code" href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">SUART_Driver</a>.<a class="code" href="structb_driver_interface__t.html#a87e704566d0a15f1aabbbfb208438c81">open</a> = _SUartNullF;</div><div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    <a class="code" href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">SUART_Driver</a>.<a class="code" href="structb_driver_interface__t.html#a92bf484ff16ad77727b6afe688c7e98e">ctl</a> = _SUartCtl;</div><div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;    <a class="code" href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">SUART_Driver</a>.<a class="code" href="structb_driver_interface__t.html#a671c1e21440d7a8a58f1e244a4880d6f">read</a> = _S_UartRead;</div><div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160;    <a class="code" href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">SUART_Driver</a>.<a class="code" href="structb_driver_interface__t.html#af67fbf8f75e899efac0872e7469a33c2">write</a> = _S_UartSendBuf;</div><div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160;    <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;}</div><div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;</div><div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;<span class="comment">/************************ Copyright (c) 2019 Bean *****END OF FILE****/</span></div><div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;</div><div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;</div><div class="ttc" id="struct_s___r_x_info__t_html_a62e96a9ecdde0ab8494d1dae9762f595"><div class="ttname"><a href="struct_s___r_x_info__t.html#a62e96a9ecdde0ab8494d1dae9762f595">S_RXInfo_t::byte</a></div><div class="ttdeci">volatile uint8_t byte</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00060">b_suart.h:60</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___exported___functions_html_gab302ede121d8fa7a6452427523b1ffeb"><div class="ttname"><a href="group___s_u_a_r_t___exported___functions.html#gab302ede121d8fa7a6452427523b1ffeb">S_UartRxTimerHandler</a></div><div class="ttdeci">void S_UartRxTimerHandler(void)</div><div class="ttdoc">RX Timer handler. </div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8c_source.html#l00224">b_suart.c:224</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html_aa2665ebcc94066966583ee7c2c754862"><div class="ttname"><a href="struct_s___r_x_info__t.html#aa2665ebcc94066966583ee7c2c754862">S_RXInfo_t::buf</a></div><div class="ttdeci">uint8_t buf[128]</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00063">b_suart.h:63</a></div></div>
<div class="ttc" id="b__hal_8h_html"><div class="ttname"><a href="b__hal_8h.html">b_hal.h</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html_a533fda1241149e9fe787957492b2b1fc"><div class="ttname"><a href="structb_driver_interface__t.html#a533fda1241149e9fe787957492b2b1fc">bDriverInterface_t::close</a></div><div class="ttdeci">int(* close)(void)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00077">b_device.h:77</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___exported___defines_html_gaa319b4bfa61f71bb997013eb2de3eee4"><div class="ttname"><a href="group___s_u_a_r_t___exported___defines.html#gaa319b4bfa61f71bb997013eb2de3eee4">S_RX_S_START</a></div><div class="ttdeci">#define S_RX_S_START</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00086">b_suart.h:86</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html_aef4c4f3630ede69cba8c75369a5459af"><div class="ttname"><a href="struct_s___r_x_info__t.html#aef4c4f3630ede69cba8c75369a5459af">S_RXInfo_t::count</a></div><div class="ttdeci">volatile uint8_t count</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00064">b_suart.h:64</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html_a87e704566d0a15f1aabbbfb208438c81"><div class="ttname"><a href="structb_driver_interface__t.html#a87e704566d0a15f1aabbbfb208438c81">bDriverInterface_t::open</a></div><div class="ttdeci">int(* open)(void)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00076">b_device.h:76</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html"><div class="ttname"><a href="structb_driver_interface__t.html">bDriverInterface_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00073">b_device.h:73</a></div></div>
<div class="ttc" id="b__config_8h_html_a070d2ce7b6bb7e5c05602aa8c308d0c4"><div class="ttname"><a href="b__config_8h.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a></div><div class="ttdeci">#define NULL</div><div class="ttdef"><b>Definition:</b> <a href="b__config_8h_source.html#l00042">b_config.h:42</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html_a533890957460cf4f360cf222426df810"><div class="ttname"><a href="struct_s___r_x_info__t.html#a533890957460cf4f360cf222426df810">S_RXInfo_t::c_bits</a></div><div class="ttdeci">volatile uint8_t c_bits</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00062">b_suart.h:62</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html_a34ed48d0499d28be718165306a573aeb"><div class="ttname"><a href="struct_s___r_x_info__t.html#a34ed48d0499d28be718165306a573aeb">S_RXInfo_t::revf</a></div><div class="ttdeci">volatile uint8_t revf</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00065">b_suart.h:65</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html_af67fbf8f75e899efac0872e7469a33c2"><div class="ttname"><a href="structb_driver_interface__t.html#af67fbf8f75e899efac0872e7469a33c2">bDriverInterface_t::write</a></div><div class="ttdeci">int(* write)(uint32_t addr, uint8_t *pbuf, uint16_t len)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00079">b_device.h:79</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html_afea475b453c81c5b3f5a31abb861edfb"><div class="ttname"><a href="struct_s___r_x_info__t.html#afea475b453c81c5b3f5a31abb861edfb">S_RXInfo_t::status</a></div><div class="ttdeci">volatile uint8_t status</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00061">b_suart.h:61</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html_a02fecce62db76d446cceec8d87e330f9"><div class="ttname"><a href="struct_s___r_x_info__t.html#a02fecce62db76d446cceec8d87e330f9">S_RXInfo_t::idle_flag</a></div><div class="ttdeci">volatile uint8_t idle_flag</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00067">b_suart.h:67</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___exported___functions_html_gaf0674055c3083cfcf4e20633f1deabb2"><div class="ttname"><a href="group___s_u_a_r_t___exported___functions.html#gaf0674055c3083cfcf4e20633f1deabb2">S_UartTxTimerHandler</a></div><div class="ttdeci">void S_UartTxTimerHandler(void)</div><div class="ttdoc">TX Timer handler. </div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8c_source.html#l00201">b_suart.c:201</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___exported___functions_html_ga2de0a2047cfba22db54132164576cc18"><div class="ttname"><a href="group___s_u_a_r_t___exported___functions.html#ga2de0a2047cfba22db54132164576cc18">S_UartRXStart</a></div><div class="ttdeci">void S_UartRXStart(void)</div><div class="ttdoc">RX Start. </div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8c_source.html#l00209">b_suart.c:209</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___exported___defines_html_ga7b0fd6f9d6d235df0a71ae2e1a1277b6"><div class="ttname"><a href="group___s_u_a_r_t___exported___defines.html#ga7b0fd6f9d6d235df0a71ae2e1a1277b6">S_RX_S_NULL</a></div><div class="ttdeci">#define S_RX_S_NULL</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00085">b_suart.h:85</a></div></div>
<div class="ttc" id="group___h_a_l___exported___defines_html_gadd41bc5ddcf6f842928efc4f0d944a57"><div class="ttname"><a href="group___h_a_l___exported___defines.html#gadd41bc5ddcf6f842928efc4f0d944a57">S_TX_PIN_RESET</a></div><div class="ttdeci">#define S_TX_PIN_RESET()</div><div class="ttdef"><b>Definition:</b> <a href="b__hal_8h_source.html#l00069">b_hal.h:69</a></div></div>
<div class="ttc" id="group___h_a_l___exported___defines_html_gac1fbe03efbe22feb97f198a4dd8b1237"><div class="ttname"><a href="group___h_a_l___exported___defines.html#gac1fbe03efbe22feb97f198a4dd8b1237">S_RX_PIN_READ</a></div><div class="ttdeci">#define S_RX_PIN_READ()</div><div class="ttdef"><b>Definition:</b> <a href="b__hal_8h_source.html#l00070">b_hal.h:70</a></div></div>
<div class="ttc" id="b__suart_8h_html"><div class="ttname"><a href="b__suart_8h.html">b_suart.h</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___exported___functions_html_ga4905cf58b8ed4c083969f3f9131e38ff"><div class="ttname"><a href="group___s_u_a_r_t___exported___functions.html#ga4905cf58b8ed4c083969f3f9131e38ff">SUART_Init</a></div><div class="ttdeci">int SUART_Init(void)</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8c_source.html#l00267">b_suart.c:267</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html_a92bf484ff16ad77727b6afe688c7e98e"><div class="ttname"><a href="structb_driver_interface__t.html#a92bf484ff16ad77727b6afe688c7e98e">bDriverInterface_t::ctl</a></div><div class="ttdeci">int(* ctl)(uint8_t cmd, void *param)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00078">b_device.h:78</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html_a671c1e21440d7a8a58f1e244a4880d6f"><div class="ttname"><a href="structb_driver_interface__t.html#a671c1e21440d7a8a58f1e244a4880d6f">bDriverInterface_t::read</a></div><div class="ttdeci">int(* read)(uint32_t addr, uint8_t *pbuf, uint16_t len)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00080">b_device.h:80</a></div></div>
<div class="ttc" id="group___h_a_l___exported___defines_html_gac5645a8f806359e621559359dadfc7c5"><div class="ttname"><a href="group___h_a_l___exported___defines.html#gac5645a8f806359e621559359dadfc7c5">S_TX_PIN_SET</a></div><div class="ttdeci">#define S_TX_PIN_SET()</div><div class="ttdef"><b>Definition:</b> <a href="b__hal_8h_source.html#l00068">b_hal.h:68</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html_a2fca36c37bbd385665d8d422df068370"><div class="ttname"><a href="struct_s___r_x_info__t.html#a2fca36c37bbd385665d8d422df068370">S_RXInfo_t::idle_count</a></div><div class="ttdeci">volatile uint8_t idle_count</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00066">b_suart.h:66</a></div></div>
<div class="ttc" id="structb_driver_interface__t_html_a857eaefcde68aba9fe0d2170a660fdfb"><div class="ttname"><a href="structb_driver_interface__t.html#a857eaefcde68aba9fe0d2170a660fdfb">bDriverInterface_t::init</a></div><div class="ttdeci">int(* init)(void)</div><div class="ttdef"><b>Definition:</b> <a href="b__device_8h_source.html#l00075">b_device.h:75</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___exported___defines_html_ga23061086cd3c27746726d9a21801339a"><div class="ttname"><a href="group___s_u_a_r_t___exported___defines.html#ga23061086cd3c27746726d9a21801339a">S_RX_S_ING</a></div><div class="ttdeci">#define S_RX_S_ING</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00087">b_suart.h:87</a></div></div>
<div class="ttc" id="struct_s___r_x_info__t_html"><div class="ttname"><a href="struct_s___r_x_info__t.html">S_RXInfo_t</a></div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8h_source.html#l00058">b_suart.h:58</a></div></div>
<div class="ttc" id="group___s_u_a_r_t___private___variables_html_ga2653dcd74de96e06405a5207f6f53f3e"><div class="ttname"><a href="group___s_u_a_r_t___private___variables.html#ga2653dcd74de96e06405a5207f6f53f3e">SUART_Driver</a></div><div class="ttdeci">SUART_Driver_t SUART_Driver</div><div class="ttdef"><b>Definition:</b> <a href="b__suart_8c_source.html#l00078">b_suart.c:78</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>
